package com.nwpu.main;

import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.IOException;

// /**
//  * 计数标签
//  *
//  * @author liyong
//  *
//  */
// public class CounterTag extends TagSupport {
//
// 	private static int counter = 1;
//
// 	public int doStartTag() throws JspException {
// 		try {
// 			JspWriter out = pageContext.getOut();
// 			out.print(counter);
// 			System.out.println(counter);
// 			setCounter();
// 			System.out.println(counter);
// 		} catch (java.io.IOException e) {
// 			throw new JspTagException(e.getMessage());
// 		}
// 		return SKIP_BODY;
// 	}
//
// 	public int getCounter() {
// 		return counter;
// 	}
//
// 	public void setCounter() {
// 		counter++;
// 	}
// }


public class CounterTag extends SimpleTagSupport {

	private static int counter = 1;

	@Override
	public void doTag() throws JspException, IOException {
		JspWriter out = getJspContext().getOut();
		out.print(StatisticInfo.getCount());
	}

	public int getCounter() {
		return counter;
	}

	public void setCounter() {
		counter++;
	}
}